function detected_byte_sequence=hw3_director(method,h,h_hat,s,v,noise,rho,nt,nr)



detected_byte_sequence=[];
r_prev=[];
%for j=1:2
for j=1:size(s,2)
v=noise*randn(size(v)) + j*noise*randn(size(v));

if(method==1)
	r=sqrt(rho/nt)*h*s(:,j) + v;
	[s_hat,byte_signal] = null_cancel_order_bpsk(h_hat,r,rho,nt,nr);
elseif(method==2)
	s_ala=alamouti(s(:,j));
	r=sqrt(rho/nt)*h*s_ala + v;
	[s_hat,byte_signal] = alamouti_detector_qpsk(h_hat,r,rho,nt,nr);
elseif(method==3)
	s_gen=gen_ortho(s(:,j),nt,nr);
	r=sqrt(rho/nt)*h*s_gen + v;
	[s_hat,byte_signal] = gen_ortho_detector_qamsixteen(h_hat,r,rho,nt,nr);
elseif(method==4)
	s_34=rate_34(s(:,j),nt,nr);
	r=sqrt(rho/nt)*h*s_34 + v;
	[s_hat,byte_signal] = rate_34_detector_qamsixteen(h_hat,r,rho,nt,nr);
elseif(method==5)
	s_ala=alamouti(s(:,j));
	r=sqrt(rho/nt)*h*s_ala + v;
	[s_hat,byte_signal] = alamouti_detector_bpsk(h_hat,r,rho,nt,nr);
elseif(method==6)
	if(j>1)
		x_prev=s_ala;
	else
		x_prev=alamouti(s(:,j));
	end
	s_ala=diff_alamouti(s(:,j),x_prev,rho);
	r=sqrt(rho/nt)*h*s_ala + v;
	[s_hat,byte_signal] = diff_alamouti_detector_bpsk(h_hat,r,rho,nt,nr,r_prev);
	r_prev=r;
elseif(method==7)
	if(j<2)
		%initial signal, and result of initial signal at transmitter
		x_cyc41_prev=[1 -1; 1 1];		
		r_prev=sqrt(rho/nt)*h*x_cyc41_prev + v;
	else
		x_cyc41_prev=x_cyc41;
		r_prev=r;
	end
	x_cyc41=cyclic41(s(:,j),x_cyc41_prev);
	r=sqrt(rho/nt)*h*x_cyc41 + v;
	[s_hat,byte_signal] = cyclic41_detector(h_hat,r,rho,nt,nr,r_prev);
elseif(method==8)

	if(j<2)
		x_cyc43_prev=[1 -1; 1 1];
		r_prev=sqrt(rho/nt)*h*x_cyc43_prev + v;
	else
		x_cyc43_prev=x_cyc43;
		r_prev=r;
	end
	x_cyc43=cyclic43(s(:,j),x_cyc43_prev);
	r=sqrt(rho/nt)*h*x_cyc43 + v;
	[s_hat,byte_signal] = cyclic43_detector(h_hat,r,rho,nt,nr,r_prev);
end

detected_byte_sequence=horzcat(detected_byte_sequence,byte_signal);


end
